/** 错误状态码提示 */
import { t } from '@/i18n'

const errorText = (status?: number, message?: string): string => {
  switch (status) {
    case 401:
      return t('account.requestError.401')
    case 403:
      return t('account.requestError.403')
    case 404:
      return t('account.requestError.404')
    case 500:
      return message ?? t('account.requestError.500')
    default:
      switch (message) {
        case 'Network Error':
          return t('account.requestError.networkError')
        default:
          return message ?? t('account.requestError.timeout')
      }
  }
}

export default errorText
